import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;


public class CheckSystemTest {

	Card cardTest1;
	Card cardTest2;
	Card cardTest3;
	Card cardTest4;
	Card cardTest5;
	PlayerInterface player1, player2, player3, player4;
	CheckSystem x = new CheckSystem();
	Prologue getSuper;
	
	@Before
	public void setUp() {
		
		getSuper = new Prologue();
		cardTest1 = new Card(9,0);
		cardTest2 = new Card(9,1);
		cardTest3 = new Card(9,2);
		cardTest4 = new Card(10,0);
		cardTest5 = new Card(10,2);
		player1 = new PlayerInterface(1,0,getSuper);
		player1.hand[0] = cardTest1;
		player1.hand[1] = cardTest2;
		player1.hand[2] = cardTest3;
		player1.hand[3] = cardTest4;
		player1.hand[4] = cardTest5;
		
		player1.sortHand();
		
		
	}
	@Test
	public void Test1() {
		
		int tab[] = {6,11,12,0,0,0};
		int tab1[] = x.CardCheck(player1);
		for(int i=0;i<6;i++) {
			System.out.println(tab1[i]);
			assertEquals(tab[i],tab1[i]);
		}
		
	}
	@Test
	public void Test2() {
		
		cardTest1 = new Card(12,1);
		cardTest2 = new Card(10,1);
		cardTest3 = new Card(0,1);
		cardTest4 = new Card(3,1);
		cardTest5 = new Card(4,1);
		player1 = new PlayerInterface(2,0,getSuper);
		player1.hand[0] = cardTest1;
		player1.hand[1] = cardTest2;
		player1.hand[2] = cardTest3;
		player1.hand[3] = cardTest4;
		player1.hand[4] = cardTest5;
		
		player1.sortHand();
		
		int tab[] = {5,14,12,6,5,2};
		int tab1[] = x.CardCheck(player1);
		for(int i=0;i<6;i++) {
			System.out.println(tab1[i]);
			assertEquals(tab[i],tab1[i]);
		}
		
	}
	@Test
	public void Test3() {
		
		cardTest1 = new Card(12,1);
		cardTest2 = new Card(10,1);
		cardTest3 = new Card(0,1);
		cardTest4 = new Card(3,1);
		cardTest5 = new Card(4,1);
		player1 = new PlayerInterface(3,0,getSuper);
		player1.hand[0] = cardTest1;
		player1.hand[1] = cardTest2;
		player1.hand[2] = cardTest3;
		player1.hand[3] = cardTest4;
		player1.hand[4] = cardTest5;
		
		player1.sortHand();
		
		cardTest1 = new Card(11,1);
		cardTest2 = new Card(9,2);
		cardTest3 = new Card(3,0);
		cardTest4 = new Card(4,2);
		cardTest5 = new Card(5,2);
		player2 = new PlayerInterface(4,0,getSuper);
		player2.hand[0] = cardTest1;
		player2.hand[1] = cardTest2;
		player2.hand[2] = cardTest3;
		player2.hand[3] = cardTest4;
		player2.hand[4] = cardTest5;
		
		player2.sortHand();
		
		cardTest1 = new Card(12,2);
		cardTest2 = new Card(6,0);
		cardTest3 = new Card(0,2);
		cardTest4 = new Card(3,2);
		cardTest5 = new Card(5,1);
		player3 = new PlayerInterface(1,0,getSuper);
		player3.hand[0] = cardTest1;
		player3.hand[1] = cardTest2;
		player3.hand[2] = cardTest3;
		player3.hand[3] = cardTest4;
		player3.hand[4] = cardTest5;
		
		player3.sortHand();
		
		cardTest1 = new Card(10,2);
		cardTest2 = new Card(10,3);
		cardTest3 = new Card(8,3);
		cardTest4 = new Card(8,1);
		cardTest5 = new Card(8,0);
		player4 = new PlayerInterface(1,0,getSuper);
		player4.hand[0] = cardTest1;
		player4.hand[1] = cardTest2;
		player4.hand[2] = cardTest3;
		player4.hand[3] = cardTest4;
		player4.hand[4] = cardTest5;
		
		player4.sortHand();
		
		System.out.println(x.StrParse(player1));
		System.out.println(x.StrParse(player2));
		System.out.println(x.StrParse(player3));
		System.out.println(x.StrParse(player4));
	}
}
